package com.example.DbConfig;

import com.example.config.DbConfig;

import java.sql.*;

public class JdbcUtil {

    //加载驱动
    static {
        try {
            Class.forName(DbConfig.DRIVER_CLASS);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    //获取连接
    public static Connection getConnection() {
        try {
            return DriverManager.getConnection(DbConfig.URL, DbConfig.USERNAME, DbConfig.PASSWORD);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


    //关闭资源
    public static void close(Connection con, Statement stmt, ResultSet rs) {

    }







}
